package Proxy.java.dynamicProxy.oncemore;

import java.lang.reflect.Proxy;

public class TT {

    public static void main(String[] args) {
        //
        Car car = new Porsche();
        //组装方法，当然需要接口实现类
        FunctionHere functionHere = new FunctionHere(car);

        //代理哪个实现类，代理哪个接口，代理方法是什么 → 得到代理对象，调用dialing方法
        ((Car) Proxy.newProxyInstance(Porsche.class.getClassLoader(), Porsche.class.getInterfaces(), functionHere)).sellCar();

        House house = new DuplexHouse();
        FunctionHere functionHere1 = new FunctionHere(house);
        ((House)Proxy.newProxyInstance(DuplexHouse.class.getClassLoader(),DuplexHouse.class.getInterfaces(),functionHere1)).sellHouse();

    }

}
